
import javax.swing.ImageIcon;
import java.net.URL;
import java.net.MalformedURLException;

public class ImageChoice extends Choice{

	private int x; //holds the x coordinate of the choice at the panel
	private int y; //holds the y coordinate of the choice at the panel
	private javax.swing.ImageIcon imageContent =null; //holds the image of the choice
	private boolean visible = true; //holds status showing whether the choice is visible at the panel
	//private String host = "http://labsupport.no-ip.org/~s1011793/swe/";
	private String host = "http://124.244.130.242/swe/";
	private URL url;
	
	public ImageChoice(String buttonContent, int x, int y, String imageName){
		super(buttonContent);
		this.x = x;
		this.y = y;
		try{	
			url = new URL(host+imageName);
			imageContent = new ImageIcon(url);
		}catch(MalformedURLException e){
			System.err.println(e.getMessage());
		}
		/*
		if(imageContent == null){
			imageContent = new ImageIcon(getClass().getResource("image/"+imageName));
		}
		*/
	}
	
	public ImageChoice(int x, int y, String imageName){
		this("", x, y, imageName);
	}
	
	public ImageChoice(String imageName){
		this(0, 0, imageName);
	}
	
    public ImageIcon getImageContent() {
        return imageContent;
    }

    public void setImageContent(ImageIcon image) {
        this.imageContent = imageContent;
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }
    
    public boolean isVisible(){
	    return visible;
    }
    
    public void setVisible(boolean visible){
	    this.visible = visible;
	}
	
}